from typing import Optional
from pydantic import BaseModel, field_validator

from .flow_data import FlowData

class FlowCreate(BaseModel):
    name: str
    description: Optional[str] = None
    flow: FlowData

    @field_validator("name")
    @classmethod
    def _validate_name(cls, v: str) -> str:
        v = v.strip()
        if not v:
            raise ValueError("name must not be empty")
        return v